import http from "@/utils/http";

// 加入购物车
export const reqCartAdd = ({ goodsId, count, ...data }) => {
  return http.request({
    url: `/cart/addToCart/${goodsId}/${count}`,
    method: "GET",
    data: data,
  });
};

// 购物车列表
export const reqCartList = () => {
  return http.request({
    url: `/cart/getCartList`,
    method: "GET",
  });
};

// 更新商品状态
export const reqCartState = ({ goodsId, isChecked }) => {
  return http.request({
    url: `/cart/checkCart/${goodsId}/${isChecked}`,
    method: "GET",
  });
};

// 全选与全不选
export const reqCartChecked = ({ isChecked }) => {
  return http.request({
    url: `/cart/checkAllCart/${isChecked}`,
    method: "GET",
  });
};

// 删除购物车商品
export const reqCartDel = ({ goodsId }) => {
  return http.request({
    url: `/cart/delete/${goodsId}`,
    method: "GET",
  });
};
